<?php
	
	$logid=GetLoginUserID();
	if(isset($_GET['uid'])&&intval($_GET['uid'])>0)
	{
		$uid=intval($_GET['uid']);
	}
	else
	{
		if($logid!=false)
			$uid=$logid;
		else
			edp_redirect(edp_href_link(PAGENAME_PAGE_NOT_FOUND));
	}
	
	$userDAO=GetUserDAO();
	$user=$userDAO->GetUserNameByID($uid);
	if(!$user)
		edp_redirect(edp_href_link(PAGENAME_PAGE_NOT_FOUND));
		
	if(isset($_GET['s']))
		$s = $_GET['s'];
	else 
		$s = '1';			
	switch($s){		    	
	   case '2':{	   	
	      $sortby = 'create_time desc';
	      break;
	   }
	   case '3':{	   	
	      $sortby = 'response_count desc';
	      break;
	   }	   
	   case '4':{	   	
	      $sortby = 'flower_count desc';
	      break;
	   }	   
	   default:{	 
	      $sortby = 'view_count desc';
	      break;   	 	
	   }		
	}	
	
	require_once 'lib/classes/Pager.php';
	
	if( isset($_GET['p']) && is_numeric($_GET['p']) )
		$startPos = ( $_GET['p'] - 1 ) * LIST_PER_PAGE;
	else
		$startPos = 0;
		
	$currentURL = htmlspecialchars( $_SERVER["REQUEST_URI"] );
	$currentURL = preg_replace( '/&p=[0-9]+/', "", $currentURL );
		
	$listCount = $userDAO->GetListCount( $uid );
	
	$listDAO = GetListDAO();
	$lists = $listDAO->GetUserList( $uid, $startPos, LIST_PER_PAGE ,$sortby);
		
	$page = new Pager( $currentURL, $listCount, LIST_PER_PAGE, $startPos, UP_RESULT_PAGE );
	
?>
